﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace SSN.WebFramework
{
    public abstract class GenControl : System.Web.UI.UserControl
    {
        public ParameterManager ParameterManager
        {
            get
            {
                if (Page is GenPage)
                {
                    return ((GenPage)Page).ParameterManager;
                }

                return null;
            }
        }

        protected SecurityManager SecurityManager
        {
            get
            {
                if (Page is GenPage)
                {
                    return ((GenPage)Page).SecurityManager;
                }

                return null;
            }
        }

        public GenControl()
        {

        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (SecurityManager != null && SecurityManager.IsLoggedIn)
            {
                InitPage();
            }
        }


        public abstract void InitPage();
    }
}
